1. Field of the Invention
The invention relates in general to a memory management technology, and more particularly to a memory management technology applicable to a memory that simultaneously includes a working region and a compression region.
2. Description of the Related Art
Memories are an essential part in most electronic products. Taking a computer system for example, a dynamic random access memory (DRAM) is usually provided therein for temporarily storing various kinds of data or program codes required for system operations. The DRAM is advantaged by having a fast access speed and yet disadvantaged by having a cost higher than that of a hard drive or a flash memory. To attend to both considerations of hardware costs and available temporary storage space size, certain electronic systems are designed to adopt a DRAM as a primary memory and to adopt a part of a hard drive as a secondary memory. Data having a higher least recent used (LRU) index is transferred from the primary memory to the secondary memory, and relocated back to the primary memory when again utilized. Such approach is commonly referred to as swapping. However, with the swapping method, the overall efficiency is still limited by the slow data access speed of the secondary memory.
Thus, there is another memory management solution that divides the memory space of a same DRAM into a working region and a compression region. The working region stores uncompressed data. Similarly, data having a higher recent used index is compressed and transferred to the compression region. Only when needed, the data previously transferred is fetched from the compression region, decompressed and relocated back to the working region. Given appropriate compression algorithms, the compression and decompression procedures do not consume an excessive amount of operation resources. Compared to a situation where an entire DRAM is utilized as a working region, such solution stores more data in a memory space of the same size to provide enhanced utilization efficiency. However, as the compression region occupies a part of the memory space of the DRAM, it is in equivalence reducing the available capacity of the working region, which may lead to a rise in the frequency of data exchange between the working region and the compression region. Known to a person skilled in the art, the overall performance of the electronic system becomes lower as the frequency of data exchange gets higher.